package com.tarry.trade.counter;

import com.tarry.trade.counter.config.CounterConfig;
import com.tarry.trade.counter.thirdpart.uuid.MyUUID;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;

/**
 * Hello world!
 */
@SpringBootApplication
@MapperScan("com.tarry.trade.counter.mapper")
public class CounterApplication {
    public static void main(String[] args) {
        SpringApplication.run(CounterApplication.class, args);
    }

    @Autowired
    CounterConfig config;

    @PostConstruct
    private void init() {
        MyUUID.getInstance().init(config.getDataCenterId(), config.getWorkerId());
    }
}
